package com.yanqu.road.server.logic.system;

import com.yanqu.road.entity.enums.ePlayerAttrType;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.player.AttributeModule;
import com.yanqu.road.server.manger.VipMgr;
import com.yanqu.road.server.manger.log.LogMgr;

import java.math.BigInteger;

public class SystemOpenEarnSpeedFundActivity extends BaseSystemOpen{

    public SystemOpenEarnSpeedFundActivity(int systemId, GamePlayer player) {
        super(systemId, player);
    }

    @Override
    public void initSystem() {
        long hasBuy = player.getModule(AttributeModule.class).getAttribute(ePlayerAttrType.PatronsFund);
        if(hasBuy > 0){//解锁赚钱基金且购买门客基金，触发日志
            BigInteger earnSpeed = player.getUserInfo().getEarnSpeed();
            int titleId = player.getTitleId();
            long vipExp = player.getUserInfo().getVipExp();
            int vipLv = VipMgr.getVipLv(vipExp);
            LogMgr.addLogEarnSpeedFund(player.getUserId(), 0, earnSpeed, titleId, vipExp, vipLv);
        }
    }
}
